package com.lekang.service.impl;

import com.lekang.dto.CountDto;
import com.lekang.mapper.BedMapper;
import com.lekang.mapper.BillMapper;
import com.lekang.mapper.ElderlyMapper;
import com.lekang.mapper.NursingItemMapper;
import com.lekang.service.WorkBenchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class WorkBenchServiceImpl implements WorkBenchService {

    @Autowired
    private ElderlyMapper elderlyMapper;
    @Autowired
    private BillMapper billMapper;
    @Autowired
    private BedMapper bedMapper;
    @Autowired
    private NursingItemMapper nursingItemMapper;


    @Override
    public CountDto countAllSysUser() {
        CountDto countDto = new CountDto();
        countDto.setElderlyCount(elderlyMapper.countElderlyOnly());
        countDto.setBedCount(bedMapper.countAllBeds());
        countDto.setUserCount(elderlyMapper.countAllSysUser());
        countDto.setServiceCount(nursingItemMapper.countTotalValidNursingService());
        countDto.setWealthCount(billMapper.sumAllPayableAmount());
        return countDto;
    }
}
